<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<MVCWeb.Models.ViewData.VendorCommunityAdsNewViewData>" %>

<%@ Import Namespace="MVCWeb.Helpers" %>
<%@ Register Src="~/Views/Menu/MainMenu.ascx" TagName="MainMenu" TagPrefix="mmuc" %>

<%@ Register Src="~/Views/Shared/LogOnUserControl.ascx" TagName="LogOnUserControl" TagPrefix="louc" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">

    <script type="text/javascript">

        $(document).ready(function() {

        $("#Started").datepicker({ changeMonth: true, changeYear: true, showOn: 'button', buttonImage: '../Content/Images/Icons/calendar.gif', buttonImageOnly: true });
        $("#Ended").datepicker({ changeMonth: true, changeYear: true, showOn: 'button', buttonImage: '../Content/Images/Icons/calendar.gif', buttonImageOnly: true });

            $("#VendorAdsCommunityForm").validate({
                rules: {

                    Started: {
                        required: true,
                        date: true
                    },
                    Ended: {
                        required: true,
                        date: true
                    }

                },
                messages: {

                    Started: {
                        required: "Stated Date must be entered",
                        date: "Stated Date must be only valid date"
                    },
                    Ended: {
                        required: "Ended Date must be entered",
                        date: "Stated Date must be only valid date"
                    }
                }
            });
        });
    </script>

    <louc:LogOnUserControl ID="LogOnUserControl1" runat="server" />
   <!-- BEGIN: MainMenu -->
    <mmuc:MainMenu ID="MainMenu1" runat="server" />
    <!-- END: MainMenu -->
    <br />
    <%= Html.ValidationSummary("Create was unsuccessful. Please correct the errors and try again.") %>
    <% using (Html.BeginForm("Setup", "VendorCommunityAds", FormMethod.Post, new { id = "VendorAdsCommunityForm" }))
       {%>
    <fieldset>
        <legend>Create Ads for multi Communities</legend>
        <p>
            <label for="CommunityList">
                Choose communities: (Using Shift or Ctrl + mouse to select multiple items)</label>
            <%= Html.ListBox("CommunityList", new SelectList(new MVCWeb.Models.HOACRMDataContext().Communities.OrderBy(c => c.Name), "CommunityId", "Name"), new { style = "height:100px;" })%>
        </p>
        <p>
            <label for="VendorId">
                Choose a vendor:</label>
            <%= Html.DropDownList("VendorId", new SelectList(ViewData.Model.VendorList, "VendorId", "VendorName"))%>
        </p>
        <p>
            <label for="AdsId">
                Choose a Ads:</label>
            <%= Html.DropDownList("AdsId", new SelectList(ViewData.Model.AdsList, "AdsId", "Type"))%>
        </p>
        <p>
            <label for="Active">
                Active:</label>
            <%= Html.CheckBox("Active")%>
        </p>
        <p>
            <label for="Started">
                Started Date:</label>
            <%= Html.TextBox("Started", null, new { style = "width:120px; margin-right:4px;" } )%>
        </p>
        <p>
            <label for="Ended">
                Ended Date:</label>
            <%= Html.TextBox("Ended", null, new { style = "width:120px; margin-right:4px;" })%>
        </p>
        <p>
            <input type="submit" value="Create" />
        </p>
    </fieldset>
    <%= Html.Hidden("CommunityId", Session["CommunityId"] == null ? "" : Session["CommunityId"].ToString()) %>
    <% } %>
    <div>
        <%=Html.ActionLink("Back to List", "Index") %>
    </div>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="head" runat="server">
    <title>Create Ads for multi Communities</title>
</asp:Content>
